package com.excellent.item.api;

import com.excellent.item.pojo.SpecGroup;
import com.excellent.item.pojo.SpecParam;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Xxacker
 * 
 */
@RequestMapping("spec")
public interface SpecificationApi{

    /**
     * 根据分类id查询分组
     * @param cid
     * @return
     */
    @GetMapping("groups/{cid}")
    public List<SpecGroup> queryGroupsByCid(@PathVariable("cid")Long cid);

    /**
     * 根据条件查询规格参数
     * @param gid  规格参数组ID
     * @param cid  分类Id
     * @param generic    通用规格参数
     * @param searching  是否用作过滤
     * @return
     */
    @GetMapping("params")
    public List<SpecParam> queryParams(
            @RequestParam(value = "gid", required = false)Long gid,
            @RequestParam(value = "cid", required = false)Long cid,
            @RequestParam(value = "generic", required = false)Boolean generic,
            @RequestParam(value = "searching", required = false)Boolean searching
    );

    /**
     * 查询规格参数组，及组内参数
     */
    @GetMapping("{cid}")
    List<SpecGroup> querySpecsByCid(@PathVariable("cid") Long cid);
}
